import new, services.AccountsService as AccountsService
from database import Account, Money

def convertMoney(moneySource):
    money = Money(moneySource._amount, AccountsService.getCurrency(moneySource._currency))
    return money

def convertFromSOAPAccount(accountSource):
    account = Account(accountSource._name)
    account.id = accountSource._id
    account.initialAmounts = map(convertMoney, accountSource._initialAmounts._money)
    return account
